package com.wufun.overseas.view.ptr;

import android.content.Context;
import android.content.SharedPreferences;


/**
 * Created by lala on 15/7/20.
 */
public class PrefUtil {
    SharedPreferences mSharedPreferences;
    static PrefUtil prefUtil;
    Context context;

    private PrefUtil(Context context) {
        this.context = context;
        mSharedPreferences = context.getSharedPreferences("Papa_Stat_SharedPreferences", Context.MODE_PRIVATE);
    }

    public static PrefUtil getInstance(Context context) {
        if (prefUtil == null) {
            prefUtil = new PrefUtil(context);
        }
        return prefUtil;
    }

    public String getEmuApkTableList() {
        return mSharedPreferences.getString("EmuApkTableList", "");
    }

    public void setEmuApkTableList(String listStr) {
        SharedPreferences.Editor mEditor = mSharedPreferences.edit();
        mEditor.putString("EmuApkTableList", listStr);
        mEditor.commit();
    }





    public String getStatisticVisit() {
        return mSharedPreferences.getString("statisticVisit", "0");
    }

    public void setStatisticVisit(String time) {
        SharedPreferences.Editor mEditor = mSharedPreferences.edit();
        mEditor.putString("statisticVisit", time);
        mEditor.commit();
    }

    public String getDailyReward() {
        return mSharedPreferences.getString("dailyReward", "0");
    }

    public void setDailyReward(String time) {
        SharedPreferences.Editor mEditor = mSharedPreferences.edit();
        mEditor.putString("dailyReward", time);
        mEditor.commit();
    }

    public String getGameList() {
        return mSharedPreferences.getString("statisticGameList", "0");
    }

    public void setGameList(String time) {
        SharedPreferences.Editor mEditor = mSharedPreferences.edit();
        mEditor.putString("statisticGameList", time);
        mEditor.commit();
    }

    public boolean isActived() {
        return mSharedPreferences.getBoolean("actived", false);
    }

    public void setActived(boolean f) {
        SharedPreferences.Editor mEditor = mSharedPreferences.edit();
        mEditor.putBoolean("actived", f);
        mEditor.commit();
    }


    public String getDownloadPath() {
//        return Constants.PATH_DOWNLOAD;
        return mSharedPreferences.getString("downloadPath", "");
    }


    public int getOldDatabaseVersion() {
        return mSharedPreferences.getInt("OldDatabaseVersion", 13);

    }

    public void setOldDatabaseVersion(int OldDatabaseVersion) {
        SharedPreferences.Editor mEditor = mSharedPreferences.edit();
        mEditor.putInt("OldDatabaseVersion", OldDatabaseVersion);
        mEditor.commit();
    }

    public int getNewGBAPlugType() {
        return mSharedPreferences.getInt("NewGBAPlugType", 0);
    }

    /**
     * @param NewGBAPlugType 0总是弹出提示框  1，使用新版插件
     */
    public void setNewGBAPlugType(int NewGBAPlugType) {
        SharedPreferences.Editor mEditor = mSharedPreferences.edit();
        mEditor.putInt("NewGBAPlugType", NewGBAPlugType);
        mEditor.commit();
    }

    public boolean getShowDialogNewGBAPlug() {
        return mSharedPreferences.getBoolean("ShowDialogNewGBAPlug", false);
    }

    /**
     * @param ShowDialog 0总是弹出提示框  1，使用新版插件
     */
    public void setShowDialogNewGBAPlug(boolean ShowDialog) {
        SharedPreferences.Editor mEditor = mSharedPreferences.edit();
        mEditor.putBoolean("ShowDialogNewGBAPlug", ShowDialog);
        mEditor.commit();
    }


    public boolean getFirstUserIconClick() {
        return mSharedPreferences.getBoolean("firstSetUserIcon", true);
    }

    public void setFirstUserIconClick(boolean isFirst) {
        SharedPreferences.Editor mEditor = mSharedPreferences.edit();
        mEditor.putBoolean("firstSetUserIcon", isFirst);
        mEditor.commit();
    }
    public boolean getFirstUserCenterClick() {
        return mSharedPreferences.getBoolean("firstSetUserIcon", true);
    }

    public void setFirstUserCenterClick(boolean isFirst) {
        SharedPreferences.Editor mEditor = mSharedPreferences.edit();
        mEditor.putBoolean("firstSetUserIcon", isFirst);
        mEditor.commit();
    }

    public String getBaiduAdData() {
        return mSharedPreferences.getString("baiduAdData", "");
    }

    public void setBaiduAdData(String baiduAdData) {
        SharedPreferences.Editor mEditor = mSharedPreferences.edit();
        mEditor.putString("baiduAdData", baiduAdData);
        mEditor.commit();
    }
    public String getEverdayLogin() {
        return mSharedPreferences.getString("everdayLogin", "");
    }

    public void setEverdayLogin(String everdayLogin) {
        SharedPreferences.Editor mEditor = mSharedPreferences.edit();
        mEditor.putString("everdayLogin", everdayLogin);
        mEditor.commit();
    }
    public boolean showInstallAppTotice() {
        return mSharedPreferences.getBoolean("showInstallAppTotice", false);
    }

    public void setShowInstallAppTotice(boolean showInstall) {
        SharedPreferences.Editor mEditor = mSharedPreferences.edit();
        mEditor.putBoolean("showInstallAppTotice", showInstall);
        mEditor.commit();
    }

    public void setShowForumLabelTip(boolean show) {
        SharedPreferences.Editor mEditor = mSharedPreferences.edit();
        mEditor.putBoolean("showForumLabelTip", show);
        mEditor.commit();
    }

    public boolean getShowForumLabelTip() {
        return mSharedPreferences.getBoolean("showForumLabelTip", true);
    }

    public void setAutoPlayVideoOnWifi(boolean show) {
        SharedPreferences.Editor mEditor = mSharedPreferences.edit();
        mEditor.putBoolean("autoPlayVideoOnWifi", show);
        mEditor.commit();
    }

    public boolean getAutoPlayVideoOnWifi() {
        return mSharedPreferences.getBoolean("autoPlayVideoOnWifi", true);
    }

    public void setRefreshForumIndexWhenResume(boolean refresh) {
        SharedPreferences.Editor mEditor = mSharedPreferences.edit();
        mEditor.putBoolean("refreshForumIndexWhenResume", refresh);
        mEditor.commit();
    }

    public boolean getRefreshForumIndexWhenResume() {
        return mSharedPreferences.getBoolean("refreshForumIndexWhenResume", false);
    }

    public void setShowPostHelpCoastTip(boolean show) {
        SharedPreferences.Editor mEditor = mSharedPreferences.edit();
        mEditor.putBoolean("showPostHelpCoastTip", show);
        mEditor.commit();
    }

    public boolean getShowPostHelpCoastTip() {
        return mSharedPreferences.getBoolean("showPostHelpCoastTip", true);
    }

    public void setUUID(String uuid) {
        SharedPreferences.Editor mEditor = mSharedPreferences.edit();
        mEditor.putString("papauuidkey", uuid);
        mEditor.commit();
    }

    public String getUUID() {
        return mSharedPreferences.getString("papauuidkey", "");
    }
}
